package com.ruoyi.web.controller.pollution;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.pollution.domain.BusPsBasMonitoringscheme;
import com.ruoyi.pollution.service.IBusPsBasMonitoringschemeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 监测方案Controller
 * 
 * @author ruoyi
 * @date 2025-09-16
 */
@RestController
@RequestMapping("/pollution/monitoringscheme")
public class BusPsBasMonitoringschemeController extends BaseController
{
    @Autowired
    private IBusPsBasMonitoringschemeService busPsBasMonitoringschemeService;

    /**
     * 查询监测方案列表
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGSCHEME:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusPsBasMonitoringscheme busPsBasMonitoringscheme)
    {
        startPage();
        List<BusPsBasMonitoringscheme> list = busPsBasMonitoringschemeService.selectBusPsBasMonitoringschemeList(busPsBasMonitoringscheme);
        return getDataTable(list);
    }

    /**
     * 导出监测方案列表
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGSCHEME:export')")
//    @Log(title = "监测方案", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusPsBasMonitoringscheme busPsBasMonitoringscheme)
    {
        List<BusPsBasMonitoringscheme> list = busPsBasMonitoringschemeService.selectBusPsBasMonitoringschemeList(busPsBasMonitoringscheme);
        ExcelUtil<BusPsBasMonitoringscheme> util = new ExcelUtil<BusPsBasMonitoringscheme>(BusPsBasMonitoringscheme.class);
        util.exportExcel(response, list, "监测方案数据");
    }

    /**
     * 获取监测方案详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGSCHEME:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busPsBasMonitoringschemeService.selectBusPsBasMonitoringschemeById(id));
    }

    /**
     * 新增监测方案
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGSCHEME:add')")
//    @Log(title = "监测方案", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BusPsBasMonitoringscheme busPsBasMonitoringscheme)
    {
        return toAjax(busPsBasMonitoringschemeService.insertBusPsBasMonitoringscheme(busPsBasMonitoringscheme));
    }

    /**
     * 修改监测方案
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGSCHEME:edit')")
//    @Log(title = "监测方案", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody BusPsBasMonitoringscheme busPsBasMonitoringscheme)
    {
        return toAjax(busPsBasMonitoringschemeService.updateBusPsBasMonitoringscheme(busPsBasMonitoringscheme));
    }

    /**
     * 删除监测方案
     */
//    @PreAuthorize("@ss.hasPermi('system:MONITORINGSCHEME:remove')")
//    @Log(title = "监测方案", businessType = BusinessType.DELETE)
	@GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busPsBasMonitoringschemeService.deleteBusPsBasMonitoringschemeByIds(ids));
    }
}
